<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>编辑公告</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyui/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyui/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/buttons.css" />
<link rel="stylesheet" type="text/css" href="/jxcsxm/js/autocomplete/jquery.autocomplete.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-form.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/datagrid-detailview.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/util/jquery.cookie.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/YMLib.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/YWLib.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/autocomplete/jquery.autocomplete.js" ></script>
<style type="text/css">.table{border: 1px solid #FFE7BA;} .table tr{border: 1px solid #FFE7BA;} .table tr td{border: 1px solid #FFE7BA;}</style>
<script type="text/javascript">
function checkCf(id){
	var name=$(id).val();
	$.ajax({
			url:'/jxcsxm/tjbb/checkNameCf.do',
			data:"xmjbxx.xmmc="+name,
			type:'post',
			dataType:'json',
			success:function(msg){
				if(msg){
					alert("项目名称重复，请重新填写");
					$(id).val('');
					$(id).focus();
				    
				}
			}
		})
}



function autoCompleteXmmc(){
	$("#xmmc").autocomplete("/jxcsxm/tjbb/autoxmmc.do", {
		multiple : false,
		minChars :1,
		multipleSeparator : ' ',
		mustMatch: true,
  		cacheLength : 0,
  		delay : 0,
  		max : 150,
  		extraParams : {
  				"xmjbxx.xmmc":function() {
  				var d = $("#xmmc").val();
  				return d;
  			}
  		},
  		dataType : 'json',// 返回类型
  		// 对返回的json对象进行解析函数，函数返回一个数组
  		parse : function(data) {
  			var aa = [];
  			aa = $.map(eval(data), function(row) {
  					return {
  						data : row,
  						value : row.xmmc.replace(/(\s*$)/g,""),
  						result : row.xmmc.replace(/(\s*$)/g,"")
  					};
  				});
  			return aa;
  		},formatItem : function(row, i, max) {
  			return row.xmmc.replace(/(\s*$)/g,"");
  		}
  	}).result(function(e, item) {
  		$("#twh1").val(item.twh.substring(0,item.twh.indexOf("[")));
  		$("#twh2").val(item.twh.substring(item.twh.indexOf("[")+1,item.twh.indexOf("]")));
  		$("#twh3").val(item.twh.substring(item.twh.indexOf("]")+1,item.twh.indexOf("号")));
  		$("#jwh1").val(item.jwh.substring(0,item.jwh.indexOf("[")));
  		$("#jwh2").val(item.jwh.substring(item.jwh.indexOf("[")+1,item.jwh.indexOf("]")));
  		$("#jwh3").val(item.jwh.substring(item.jwh.indexOf("]")+1,item.jwh.indexOf("号")));
  		$("#jhje").val(item.jhje);
  		if(item.id==null||item.id==""){
  			$("#id").val(newGuid());
  			queryysqlist($("#id").val());
  		}else{
  			$("#id").val(item.id);
  			queryysqlist(item.id);
  			
  		}
	});
}

$(function(){
	$("#id").val(parent.YMLib.Var.data.id);
	$("#name").val(parent.YMLib.Var.data.name);
	$("#content").val(parent.YMLib.Var.data.content);

	var yf=new Date().getMonth()+1;
	var day=new Date().getDate();
	if(yf<10) yf='0'+yf;
	if(day<10) day='0'+day;
	$("#fbrq1").datebox('setValue',parent.YMLib.Var.data.fbrq);
	$("#fbrq").val(parent.YMLib.Var.data.fbrq);

	$("#fbr").val(parent.YMLib.Var.data.fbr);

})

function zjdwtj(){
	if($("#id").val()==null||$("#id").val()=='')
	$("#id").val(newGuid());

	$('#fbrq').val($('#fbrq1').datebox("getValue"));

	if($("#name").val()==''||$("#name").val()==null){
		alert("公告名称不能为空");
		return;
	}
	if($("#content").val()==''||$("#content").val()==null){
		alert("公告内容不能为空");
		return;
	}
	if($("#fbrq").val()==''||$("#fbrq").val()==null){
		alert("公告日期不能为空");
		return;
	}

	if($("#fbr").val()==''||$("#fbr").val()==null){
		alert("公告人不能为空");
		return;
	}

		loadjzt();
		$('#submit').ajaxSubmit({
			dataType:'json',
			success:function(msg){
				if(msg){
					disLoadjzt();
					alert("保存成功！");
					// zjdwxz();
					// parent.$("#ysqlb").datagrid('reload');
					// closeWindow();
				}else{
					disLoadjzt();
					alert("保存失败！");
				}
			},
			error:function(msg){
				disLoadjzt();
				alert("保存失败！");
			}
		});
}

</script>
</head>
<body>

<form id="submit" action="/jxcsxm/tjbb/insertNotice.do" method="post">
<table class='table' style="width: 100%; background-color: #FFE7BA; font-size: 12px"
			border="0" cellpadding="3" cellspacing="1">

	<tr style="height: 35px;">
		<td style="background-color:#FFEFD5;color: #007DB3; font-weight: bold;" align="right"  width="140px;">公告名称：</td>
		<td style="background-color: #ffffff; height: 20px;" align="left" colspan="3">
			<input type="text" name="xmjbxx.name" id="name" style="width: 700px"/>
			<input type="hidden" name="xmjbxx.id" id="id"  />
		</td>
	</tr>

	<tr style="height: 80px;">
		<td style="background-color:#FFEFD5;color: #007DB3; font-weight: bold;" align="right">公告内容：</td>
		<td style="background-color: #ffffff; height: 20px;" align="left" colspan="3" align="center">
			<input type="text"  data-options="multiline:'true'" class="easyui-textbox"  name="xmjbxx.content" id="content" style="height: 100px;width: 490px;" />
		</td>
	</tr>

		<tr style="height: 35px;">
					<td style="background-color:#FFEFD5;color: #007DB3; font-weight: bold;" align="right">公告日期：</td>
					<td style="background-color: #ffffff; height: 20px;" align="left">
						<input type="text" class='easyui-datebox' name="fbrq1" id="fbrq1" style="width: 124px" />
						<input type="hidden" name="xmjbxx.fbrq" id="fbrq" style="width: 124px" />
					</td>
		</tr>

		<tr style="height: 35px;">
			<td style="background-color:#FFEFD5;color: #007DB3; font-weight: bold;" align="right">公告人：</td>
			<td style="background-color: #ffffff; height: 20px;" align="left" colspan="3">
				<input type="text" name="xmjbxx.fbr" id="fbr" style="width: 124px" readonly="readonly"/>
			</td>
		</tr>

		<tr style="height: 35px;">
			<td colspan="4" style="background-color: #ffffff;"align="center">
			<a id='mybuttion1' style="margin-left: 5px;margin-bottom: 1px;" href="javascript:zjdwtj()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion1')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion1')"  class="button button-tiny button-rounded button-raised button-primary">保存</a>
			<a id='mybuttion2' style="margin-left: 5px;margin-bottom: 1px;" href="javascript:closeWindow()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion2')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion2')"  class="button button-tiny button-rounded button-raised button-primary">取消</a>
		</tr>

		</table>
	</form>
</body>
</html>